package com.wuzuqing.android.eightdiagrams.term;



public class SolarUtil extends SolarConstant {
        public static boolean isLeapYear(int year) {
            return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
        }

        public static int getDaysOfMonth(int year, int month) {
            int m = month - 1;
            int d = DAYS_OF_MONTH[m];
            if (m == 1 && isLeapYear(year)) {
                d++;
            }
            return d;
        }

        public static int getWeeksOfMonth(int year, int month, int start) {
            int days = getDaysOfMonth(year, month);
            ExactDate firstDate = ExactDate.fromYmd(year, month, 1);
            int firstDayWeek = firstDate.getDay();
            return (int) Math.ceil((days + firstDayWeek - start) / 7d);
//            return 0;
        }
    }
